/**
 * 定义运营单位模块
 */
(function(window, angular, undefined){
	var module = angular.module('water.apps.ws.wsclcManager.wsclcInfo.operationsUnitManager', ['water.entity.operationsUnit']);
	
	module.controller('OperationsUnitManagerController',function($wdp,$rootScope,$scope,$OperationsUnitService){
		/**
		 * 查询条件
		 */
		$scope.queryObject={};
		/**
		 * 运营数据
		 */
		$scope.operationsUnitData={};
		
		/**
		 * 监控污水处理厂id变化
		 */
		if($wdp.viewValue.wwtpDetailParmWatch){
			$wdp.viewValue.wwtpDetailParmWatch();
		}
		$wdp.viewValue.wwtpDetailParmWatch = $rootScope.$watch(function(){return $wdp.viewValue.wwtpDetailParm;},function(){
			if(!$wdp.viewValue.wwtpDetailParm){
				return;
			}
			$scope.queryObject.WWTP_ID = $wdp.viewValue.wwtpDetailParm.WWTPID;
			$scope._getWsclcList();
        },true);
		/**
		 * 获取运营单位数据
		 */
		$scope._getWsclcList=function(){
			$OperationsUnitService.getList($scope.queryObject).then(function(d){
				if(d.data.length < 1){
					$scope.operationsUnitData = {};
					return;
				}
				$scope.operationsUnitData=d.data[0];
			});
		};
	});
}(window, angular));